#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    if (n == 2) {
        cout << 1 << endl;
        return 0;
    }
    ll m = n * (n + 1) / 2;
    for (ll d = 2; d * d <= m; d++) {
        if (m % d == 0) {
            cout << m / d << endl;
            return 0;
        }

    }
    return 0;
}
